import { connect } from 'dva';
import styles from './Counter.css';

const Counter = ({ dispatch, count }) => {
    return (
        <div className={styles.counter}>
            <div className={styles.record}>Highest Record: {count.record}</div>
            <div className={styles.current}>{count.current}</div>
            <div className={styles.buttonBox}>
                <button onClick={() => { dispatch({type: 'count/add'}); }}>+</button>
                <button onClick={() => { dispatch({type: 'count/minus'}); }}>-</button>
            </div>
        </div>
    );
};

export default connect(({ count }) => ({ count }))(Counter);